package com.ithema.chen;

public class Test4 {
    public static void main(String[] args) {
        int[] arr1 = {11,22,33,44};
        // int[] arr2 = arr1;
        int[] arr2 = new int[arr1.length];
        copy(arr1,arr2);

        printArray(arr1);
        printArray(arr2);
    }
    public static void printArray(int[] arr){
        System.out.print("[");
        for (int i = 0; i < arr.length; i++) {
            System.out.print(i==arr.length - 1? arr[i] : arr[i] + ",");
            int k =0;

            String b = k == 0?"是":"否";

            if(k==0){
                b= "是";
            }else{
                b= "否";
            }
        }
        System.out.println("]");


    }

    //深拷贝   arr1 = arr2
    public static void copy(int[] arr1,int[] arr2){
        //正式完成元素复制
        for (int i = 0; i < arr1.length; i++) {
            arr2[i] = arr1[i];
        }
    }
}
